import sys
import time
import itertools
import calcutils

def altsum3d():
    result = 0
    for x in range(100):
        for y in range(100):
            for z in range(100):
                result += calcutils.calc(x, y, z)
    return result

def sum3d(a):
    result = 0
    for x in range(100):
        for y in range(100):
            for z in range(100):
                result += a[x][y][z]
    return result

def main(argv):
    a = [[[calcutils.calc(x, y, z) for x in range(100)] for y in range(100)] for z in range(100)]
    #print(a)

    t0 = time.time()
    print(sum3d(a))
    t1 = time.time()
    print("sum3d took", t1 - t0);

    t2 = time.time()
    print(altsum3d())
    t3 = time.time()
    print("altsum3d took", t3 - t2);

if __name__ == "__main__":
    main(sys.argv)
